package com.b510.test;

import java.io.IOException;
import java.net.MalformedURLException;
import java.util.List;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.b510.bean.Person;
import com.b510.service.PersonService;
import com.svo.util.MemcachedUtils;

public class SpringJDBCTest66 {
	
    public static void main(String[] args) throws MalformedURLException, IOException {
        ApplicationContext act = new ClassPathXmlApplicationContext("bean.xml");
        testMemcache();
        testDatabase(act);
    }

	private static void testMemcache() {
		MemcachedUtils.add("abc", "duweibin");
        String object = (String) MemcachedUtils.get("abc");
        System.out.println("no:"+object);
	}

	private static void testDatabase(ApplicationContext act) {
		PersonService personService = (PersonService) act.getBean("personService");
        List<Person> persons = personService.getPerson();
        System.out.println(persons.size());
        for (Person person : persons) {
//        	System.out.println("no:"+person.getId()+","+person.getName());
		}
	}
    

}